<?php
namespace Api\Controller;
use Think\Controller;
class UserController extends Controller {
   public function getuser(){
        $users=M('users');
        $data=$users->order("uid")->select();
        echo json_encode($data);
    }
    public function getinterests(){
        $interests=M('interests');
        $data=$interests->order("iid")->select();
        echo json_encode($data);
    }
    public function login(){
    	$data['uname']=$_GET['uname'];
    	$data['upassword']=$_GET['upassword'];
    	$userModel=M('users');
    	$users=$userModel->where($data)->select();
        var_dump($users);
    	echo json_encode($users);
    }
    public function regist(){
    	//要写入的数据
    	$data['uname']=$_POST['uname'];
    	$data['upassword']=md5($_POST['upassword']);
    	$data['uphonenumber']=$_POST['uphonenumber'];
    	$data['uaddress']=$_POST['uaddress'];
    	$users=M('users');
    	$last=$users->add($data);
    	echo json_encode($last);
    }

} 